package com.czy.owner.adapter;

import android.content.Context;
import android.graphics.Paint;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.load.resource.drawable.GlideDrawable;
import com.czy.owner.R;
import com.czy.owner.entity.ShoppingModel;
import com.czy.owner.entity.TestingDetailsModel;
import com.czy.owner.utils.glide.GlideUtils;
import com.czy.owner.widget.SquaredImageView;
import com.easyrecycleview.adapter.BaseViewHolder;
import com.easyrecycleview.adapter.RecyclerArrayAdapter;

import java.util.ArrayList;


/**
 * Created by asus on 2017/5/9.
 */
public class ExpandImgAdapter extends RecyclerArrayAdapter<TestingDetailsModel.OwnerInspectionResModel> {

    public ExpandImgAdapter(Context context) {
        super(context);
    }



    @Override
    public BaseViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) {
        return new ExpandImgHolder(parent);
    }



    class ExpandImgHolder extends BaseViewHolder<TestingDetailsModel.OwnerInspectionResModel> {

        private SquaredImageView squaredImageView;

        public ExpandImgHolder(ViewGroup parent) {
            super(parent, R.layout.item_expand_img);
            squaredImageView = $(R.id.img_square);
        }

        @Override
        public void setData(TestingDetailsModel.OwnerInspectionResModel model) {
            super.setData(model);

            GlideUtils.loadImage(getContext(), model.getResUrl(), squaredImageView, new GlideUtils.ImageLoadListener<String, GlideDrawable>() {
                @Override
                public void onLoadingComplete(String uri, ImageView view, GlideDrawable resource) {

                }

                @Override
                public void onLoadingError(String source, Exception e) {

                }
            }, R.mipmap.defalut_inspection, R.mipmap.defalut_inspection);

        }
    }
}

